package com.rd.student.wulian.wanggaobo.day0731;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class RandomNum03 {
    public static void main(String[] args) {
        Random random = new Random();
        List<Integer> numbers = new ArrayList<>();

        while (numbers.size() < 20) {
            int num = random.nextInt(50);

            if (!numbers.contains(num)) {
                numbers.add(num);
            }
        }
        
        for (int i = 0; i < numbers.size(); i++) {
            System.out.println(numbers.get(i));
        }
    }
}